home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Kit PC World De Ampliacion De Windows 95
/
Kit PC World de ampliacion de Windows 95.iso
/
internet
/
sweeper
/
samples
/
olecon~1
/
wizards
/
autocvt.frm
next >
Wrap
Text File
|
1995-11-25
|
9KB
|
276 lines
VERSION 4.00
Begin VB.Form frmTransform
BorderStyle = 3 'Fixed Dialog
Caption = "Generating Automation Server"
ClientHeight = 1695
ClientLeft = 4110
ClientTop = 5550
ClientWidth = 6090
ControlBox = 0 'False
Height = 2100
Left = 4050
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1695
ScaleWidth = 6090
ShowInTaskbar = 0 'False
Top = 5205
Width = 6210
Begin ComctlLib.ProgressBar ProgressBar1
Height = 255
Left = 600
TabIndex = 1
Top = 840
Width = 4815
_Version = 65536
_ExtentX = 8493
_ExtentY = 450
_StockProps = 192
Appearance = 1
End
Begin VB.Label lblmessage
Alignment = 2 'Center
Caption = "Label1"
Height = 495
Left = 600
TabIndex = 0
Top = 120
Width = 4695
End
End
Attribute VB_Name = "frmTransform"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long _
)
Dim m_szGuidLibid As String
Dim m_szGuidPrimaryDispatch As String
Dim m_szGuidCoClass As String
Private Sub Form_Load()
Show
On Error GoTo Blech
If Dir(szSourceDir) = "" Then
Blech:
szSourceDir = InputBox("Unable to find Template files in '" + szFinalDir + "'. Please Enter an alternate location.", "Control Wizard")
End If
On Error GoTo 0
lblmessage.Caption = "Creating Directories"
Refresh
m_CreateDirs
ProgressBar1.Value = 25
lblmessage.Caption = "Generating GUIDs"
Refresh
m_MakeGUIDs
ProgressBar1.Value = 50
lblmessage.Caption = "Copying over server files"
Refresh
m_CopyFiles
ProgressBar1.Value = 75
lblmessage.Caption = "Setting up server"
Refresh
m_ReplaceNames
ProgressBar1.Value = 100
Refresh
End Sub
Sub m_MakeGUIDs()
m_szGuidLibid = GenerateUUID
m_szGuidPrimaryDispatch = GenerateUUID
m_szGuidCoClass = GenerateUUID
End Sub
Private Sub m_CreateDirs()
On Error GoTo die
MkDir szFinalDir
MkDir szFinalDir + "\Release"
MkDir szFinalDir + "\Debug"
Exit Sub
die:
MsgBox "Couldn't Create directories"
End
End Sub
Private Sub m_CopyFiles()
Dim s As String
s = szControlName
FileCopy szSourceDir + "\AutoDisp.h", szFinalDir + "\Dispids.h"
FileCopy szSourceDir + "\guids.cpp", szFinalDir + "\Guids.Cpp"
FileCopy szSourceDir + "\Autoguid.h", szFinalDir + "\Guids.H"
FileCopy szSourceDir + "\AutoObj.H", szFinalDir + "\LocalObj.H"
FileCopy szSourceDir + "\MakeAuto", szFinalDir + "\Makefile"
FileCopy szSourceDir + "\AutoRes.H", szFinalDir + "\Resource.H"
FileCopy szSourceDir + "\AutoIPSv.Cpp", szFinalDir + "\" + szServerName + ".Cpp"
FileCopy szSourceDir + "\AutoTmpl.Def", szFinalDir + "\" + szServerName + ".Def"
FileCopy szSourceDir + "\AutoTmpl.ODL", szFinalDir + "\" + szServerName + ".ODL"
If g_fSatellite = False Then
FileCopy szSourceDir + "\AutoTmpl.RC", szFinalDir + "\" + szServerName + ".RC"
Else
FileCopy szSourceDir + "\AutoTSat.RC", szFinalDir + "\" + szServerName + ".RC"
End If
FileCopy szSourceDir + "\AutoTmpl.Cpp", szFinalDir + "\" + s + "Obj.Cpp"
FileCopy szSourceDir + "\AutoTmpl.H", szFinalDir + "\" + s + "Obj.H"
FileCopy szSourceDir + "\Debug\Make.Bat", szFinalDir + "\Debug\Make.Bat"
FileCopy szSourceDir + "\Release\Make.Bat", szFinalDir + "\Release\Make.Bat"
End Sub
Private Sub m_ReplaceNames()
Dim s As String
s = szControlName
ReplaceFile szFinalDir + "\guids.cpp", "<<DEFSERVERNAME>>", szServerName
ReplaceFile szFinalDir + "\localobj.H", "<<DEFOBJECTNAMECAPS>>", UCase(szControlName)
ReplaceFile szFinalDir + "\makefile", "<<DEFSERVERNAME>>", szServerName
ReplaceFile szFinalDir + "\makefile", "<<DEFOBJECTNAME>>", szControlName
ReplaceFile szFinalDir + "\" + szServerName + ".cpp", "<<DEFOBJECTNAME>>", szControlName
ReplaceFile szFinalDir + "\" + szServerName + ".cpp", "<<DEFSERVERNAME>>", szServerName
ReplaceFile szFinalDir + "\" + szServerName + ".cpp", "<<USESSATELLITELOCALIZATION>>", UCase(Str$(g_fSatellite))
ReplaceFile szFinalDir + "\" + szServerName + ".def", "<<DEFSERVERNAME>>", szServerName
ReplaceFile szFinalDir + "\" + szServerName + ".odl", "<<DEFSERVERNAME>>", szServerName
ReplaceFile szFinalDir + "\" + szServerName + ".odl", "<<DEFOBJECTNAME>>", szControlName
ReplaceFile szFinalDir + "\" + szServerName + ".odl", "<<GUID_LIBID>>", m_szGuidLibid
ReplaceFile szFinalDir + "\" + szServerName + ".odl", "<<GUID_PRIMARY>>", m_szGuidPrimaryDispatch
ReplaceFile szFinalDir + "\" + szServerName + ".odl", "<<GUID_COCLASS>>", m_szGuidCoClass
ReplaceFile szFinalDir + "\" + szServerName + ".rc", "<<DEFSERVERNAME>>", szServerName
ReplaceFile szFinalDir + "\" + s + "Obj.Cpp", "<<DEFOBJECTNAME>>", szControlName
ReplaceFile szFinalDir + "\" + s + "Obj.Cpp", "<<DEFOBJECTNAMECAPS>>", UCase(szControlName)
ReplaceFile szFinalDir + "\" + s + "Obj.Cpp", "<<DEFOBJECTTRUNCNAME>>", s
ReplaceFile szFinalDir + "\" + s + "Obj.h", "<<DEFSERVERNAME>>", szServerName
ReplaceFile szFinalDir + "\" + s + "Obj.h", "<<DEFOBJECTNAME>>", szControlName
ReplaceFile szFinalDir + "\" + s + "Obj.h", "<<DEFOBJECTNAMECAPS>>", UCase(szControlName)
ReplaceFile szFinalDir + "\" + s + "Obj.h", "<<DEFOBJECTTRUNCNAME>>", s
#If 0 Then
If g_fSatellite = True Then
ReplaceFile szFinalDir + "\French\Makefile", "<<DEFCONTROLNAME>>", szControlName
ReplaceFile szFinalDir + "\French\" + s + "Sat.Def", "<<DEFCONTROLNAME>>", szControlName
ReplaceFile szFinalDir + "\French\" + s + "Sat.Rc", "<<DEFCONTROLNAME>>", szControlName
ReplaceFile szFinalDir + "\French\" + s + "Sat.Rc", "<<DEFCONTROLNAMECAPS>>", UCase(szControlName)
ReplaceFile szFinalDir + "\French\" + s + "Sat.ODL", "<<DEFCONTROLNAME>>", szControlName
ReplaceFile szFinalDir + "\French\" + s + "Sat.ODL", "<<GUID_LIBID>>", m_szGuidLibid
ReplaceFile szFinalDir + "\French\" + s + "Sat.ODL", "<<GUID_PRIMARYDISPATCH>>", m_szGuidPrimaryDispatch
ReplaceFile szFinalDir + "\French\" + s + "Sat.ODL", "<<GUID_EVENTINTERFACE>>", m_szGuidEventInterface
ReplaceFile szFinalDir + "\French\" + s + "Sat.ODL", "<<GUID_COCLASS>>", m_szGuidCoClass
End If
#End If
End Sub
Function ReplaceData(ByVal sData As String, ByVal sInToken As String, ByVal sOutToken As String) As String
If Len(sData) = 0 Then Exit Function
Dim iLast As Integer
Dim sPart As String
Dim sTemp As String
sTemp = sData
'Now do double quotes
iLast = InStr(sData, sInToken)
While iLast
sPart = sPart & Left$(sData, iLast - 1) & sOutToken
sData = Right$(sData, Len(sData) - iLast - Len(sInToken) + 1)
iLast = InStr(sData, sInToken)
Wend
sData = sPart & sData
'Debug.Print sData
ReplaceData = sData
End Function
Function ReplaceFile(ByVal sInName As String, ByVal sInToken As String, ByVal sOutToken As String) As Boolean
Dim iFNum As Integer
Dim iFOut As Integer
Dim sHead As String
Dim sTemp As String
On Error GoTo fncopnerr
'Open the files
iFNum = FreeFile
Open sInName For Input As #iFNum
iFOut = FreeFile
Open szFinalDir + "\moo.Tmp" For Output As #iFOut
Do Until EOF(iFNum)
Line Input #iFNum, sTemp
sTemp = ReplaceData(sTemp, sInToken, sOutToken)
Print #iFOut, sTemp
Loop
Close #iFNum
Close #iFOut
Kill sInName
Name szFinalDir + "\moo.tmp" As sInName
ReplaceFile = True
Exit Function
fncopnerr:
MsgBox "Reap File Error - " & Error$ & ""
' Resume
ReplaceFile = False
Exit Function
End Function
Function GenerateUUID() As String
Shell "uuidgen -oMaggots.987"
Call Sleep(2000)
Open "Maggots.987" For Input As 1
Line Input #1, GenerateUUID
Close #1
Kill "maggots.987"
End Function
Function GetPPGGuidString() As String
Dim s As String
s = "DEFINE_GUID(CLSID_" + szControlName + "GeneralPage, 0x" + Left(m_szGuidPropPage, 8) _
+ ", 0x" + Mid(m_szGuidPropPage, 10, 4) + ", 0x" + Mid(m_szGuidPropPage, 15, 4) _
+ ", 0x" + Mid(m_szGuidPropPage, 20, 2) + ", 0x" + Mid(m_szGuidPropPage, 22, 2) _
+ ", 0x" + Mid(m_szGuidPropPage, 25, 2) + ", 0x" + Mid(m_szGuidPropPage, 27, 2) _
+ ", 0x" + Mid(m_szGuidPropPage, 29, 2) + ", 0x" + Mid(m_szGuidPropPage, 31, 2) _
+ ", 0x" + Mid(m_szGuidPropPage, 33, 2) + ", 0x" + Mid(m_szGuidPropPage, 35, 2) _
+ ");"
GetPPGGuidString = s
End Function